# K1: not done in code
# K2: p-curve
# Tables K1-K2: not in code
# K3: Forest plot in elections
# K4: Forest plot with unpublished work
##########################################################################
rm(list = ls())
cat("\014")
set.seed(30030)
library(ggplot2)
library(dplyr)
library(tidyverse)
library(ggrepel)
library(metaplus)
library(rmeta)
library(mvmeta)
library(meta)
library(metafor)
library(foreign)
library(readstata13)
library(lubridate)
library(dmetar) #see here for special instructions: https://bookdown.org/MathiasHarrer/Doing_Meta_Analysis_in_R/dmetar.html
library(xtable)
library(zoo)
setwd("~/Dropbox/Projeto Eleições 2018/Fake News/Replication-JoP/data_meta")
##########################################################################
#### load study data ####
dat.berinsky <- read.dta13("berinsky2017.dta")
dat.berinskycces <- read.dta13("berinsky2017-cces.dta")
dat.clayton <- read.dta13("clayton2019.dta")
dat.huang1 <- read.delim("huang2017-1.tab")
dat.huang2 <- read.delim("huang2017-2.tab")
dat.nyhan1 <- read.dta13("nyhan2019-1.dta")
dat.nyhan2 <- readRDS("nyhan2019-2.rds")
dat.nyhanreifler1 <- read.dta13("nyhanreifler2010-1.dta")
dat.nyhanreifler2 <- read.dta13("nyhanreifler2010-2.dta")
dat.woodporter1 <- read.csv("elusive-tab 1.csv")
##########################################################################
#### standardized effect size function ####
#Adapted from Paluck et al
stand.result <- function( eff.type , u.s.d , ctrl.sd , n.t, n.c){
## All calculations taken from Cooper, Hedges, and Valentine (2009)
# difference in differences
if (eff.type == "d.i.d"){
d <- round(u.s.d / ctrl.sd, digits = 3)
}
# difference in means
else if (eff.type == "d.i.m"){
d <- round(u.s.d / ctrl.sd, digits = 3)
}
# reporting of change of SDs in text:
else if(eff.type == "d"){
d <- u.s.d
}
# regression coefficient
else if (eff.type == "reg.coef"){
d <- round(u.s.d / ctrl.sd, digits = 3)
}
# t test
else if (eff.type == "t.test"){
d <- round(u.s.d * sqrt( (n.t + n.c ) / (n.t * n.c) ) , digits = 3)
}
# f.test
else if (eff.type == "f.test"){
d <- round(sqrt( ( u.s.d * (n.t + n.c) ) / (n.t * n.c) ), digits = 3)
}
# compute variance of the estimated effect size
ust.var.d <- (((n.t + n.c)
/ (n.t * n.c))
+
((d^2) / (2*(n.t + n.c)) )
)
# Apply hedge's g correction
hedge.g <- 1 - (3
/
(4*(n.t + n.c -2 ) -1))
var.d <- round((hedge.g^2) * ust.var.d, digits = 3)
# standard error is the square root of variance
st.err.g <- round(sqrt(var.d), digits = 3)
# print everything out
results <- c(d, var.d, st.err.g)
col.names <- c("Standardized Effect" , "Variance of D" , "Standard Error of D")
results.table <-data.frame(col.names, results)
return(results.table)
}
##########################################################################
####  analyze data ####
#(a) berinsky 2017####
#from table 1, attentive sample (non-attentive not included in replication code)
dat.berinsky$outcome <- ifelse(dat.berinsky$w1_euth == "no",1,0) #code dichotomous with reject rumor as 1
n1 <- length(dat.berinsky$outcome)
berinsky.result1 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.berinsky$outcome[dat.berinsky$treat==3],na.rm=T) - #rumor + non-partisan correction
mean(dat.berinsky$outcome[dat.berinsky$treat==2],na.rm=T),  #rumor only
ctrl.sd = sd(dat.berinsky$outcome[dat.berinsky$treat==2],na.rm=T),  #rumor only
n.t = nrow(subset(dat.berinsky,dat.berinsky$treat==3)),
n.c = nrow(subset(dat.berinsky,dat.berinsky$treat==2))
)
berinsky.result2 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.berinsky$outcome[dat.berinsky$treat==4],na.rm=T) - #rumor + gop correction
mean(dat.berinsky$outcome[dat.berinsky$treat==2],na.rm=T),  #rumor only
ctrl.sd = sd(dat.berinsky$outcome[dat.berinsky$treat==2],na.rm=T),  #rumor only
n.t = nrow(subset(dat.berinsky,dat.berinsky$treat==4)),
n.c = nrow(subset(dat.berinsky,dat.berinsky$treat==2))
)
berinsky.result3 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.berinsky$outcome[dat.berinsky$treat==5],na.rm=T) - #rumor + dem correction
mean(dat.berinsky$outcome[dat.berinsky$treat==2],na.rm=T),  #rumor only
ctrl.sd = sd(dat.berinsky$outcome[dat.berinsky$treat==2],na.rm=T),  #rumor only
n.t = nrow(subset(dat.berinsky,dat.berinsky$treat==5)),
n.c = nrow(subset(dat.berinsky,dat.berinsky$treat==2))
)
#from table 4
dat.berinskycces$outcome <- ifelse(dat.berinskycces$euth_w1 == "no ",1,0) #code dichotomous with reject rumor as 1
n2 <- length(dat.berinskycces$outcome)
berinsky.result4 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.berinskycces$outcome[dat.berinskycces$randtreat=="c"],na.rm=T) - #rumor + correction
mean(dat.berinskycces$outcome[dat.berinskycces$randtreat=="a"],na.rm=T),  #rumor only
ctrl.sd = sd(dat.berinskycces$outcome[dat.berinskycces$randtreat=="a"],na.rm=T),  #rumor only
n.t = nrow(subset(dat.berinskycces,dat.berinskycces$randtreat=="c")),
n.c = nrow(subset(dat.berinskycces,dat.berinskycces$randtreat=="a"))
)
#(b) clayton et al 2019 ####
#main effects
#(using stata .do file/table 3 to generate values for stand.result function)
n3 <- 2994
clayton.result1 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.0787899,  #warning (inverted for consistency)
ctrl.sd = 0.934205,  #control
n.t = 2530,
n.c = 2789)
clayton.result2 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.2358087,  #disputed (inverted for consistency)
ctrl.sd = 0.934205,  #control
n.t = 1645,
n.c = 2789)
clayton.result3 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.3435594,  #rated false (inverted for consistency)
ctrl.sd = 0.934205,  #control
n.t = 1707,
n.c = 2789)
#(c) einstein and glick 2015 ####
#NOT INCLUDED IN META-ANALYSIS
#"We therefore cannot fully parse whether the results presented below are attributable to the text describing the conspiracy,
#the joint effect of the conspiracy and rebuttal, or even the rebuttal on its own" (p. 686)
#i.e. respondents were exposed to conspiracy and rebuttal simultaneously, so there is no true way to isolate correction effect
#(d) huang 2017 ####
dat.huang1$outcome1 <- 8 - dat.huang1$rumorabelief #invert rumor belief scale to be rumor disbelief scale (for consistency)
dat.huang1$outcome2 <- 8 - dat.huang1$rumorbbelief
dat.huang2$outcome1 <- 8 - dat.huang2$rumorabelief
dat.huang2$outcome2 <- 8 - dat.huang2$rumorbbelief
n4 <- length(dat.huang1$outcome1)
n5 <- length(dat.huang1$outcome2)
n6 <- length(dat.huang2$outcome1)
n7 <- length(dat.huang2$outcome2)
#STUDY 1
huang.result1 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.huang1$outcome1[dat.huang1$rebuta==1],na.rm=T) - #rumor a/b + rebuttal a
mean(dat.huang1$outcome1[dat.huang1$rumor==1],na.rm=T),  #rumor a/b only
ctrl.sd = sd(dat.huang1$outcome1[dat.huang1$rumor==1],na.rm=T),  #rumor a/b only
n.t = nrow(subset(dat.huang1,dat.huang1$rebuta==1)),
n.c = nrow(subset(dat.huang1,dat.huang1$rumor==1))
)
huang.result2 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.huang1$outcome2[dat.huang1$rebutb==1],na.rm=T) - #rumor a/b + rebuttal b
mean(dat.huang1$outcome2[dat.huang1$rumor==1],na.rm=T),  #rumor a/b only
ctrl.sd = sd(dat.huang1$outcome2[dat.huang1$rumor==1],na.rm=T),  #rumor a/b only
n.t = nrow(subset(dat.huang1,dat.huang1$rebutb==1)),
n.c = nrow(subset(dat.huang1,dat.huang1$rumor==1))
)
#STUDY 2
huang.result3 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.huang2$outcome1[dat.huang2$rebuta==1],na.rm=T) - #rumor a/b + rebuttal a
mean(dat.huang2$outcome1[dat.huang2$rumor==1],na.rm=T),  #rumor a/b only
ctrl.sd = sd(dat.huang2$outcome1[dat.huang2$rumor==1],na.rm=T),  #rumor a/b only
n.t = nrow(subset(dat.huang2,dat.huang2$rebuta==1)),
n.c = nrow(subset(dat.huang2,dat.huang2$rumor==1))
)
huang.result4 <- stand.result(eff.type = "d.i.m",
u.s.d = mean(dat.huang2$outcome2[dat.huang2$rebutb==1],na.rm=T) - #rumor a/b + rebuttal b
mean(dat.huang2$outcome2[dat.huang2$rumor==1],na.rm=T),  #rumor a/b only
ctrl.sd = sd(dat.huang2$outcome2[dat.huang2$rumor==1],na.rm=T),  #rumor a/b only
n.t = nrow(subset(dat.huang2,dat.huang2$rebutb==1)),
n.c = nrow(subset(dat.huang2,dat.huang2$rumor==1))
)
#(e) nyhan et al 2019 ####
#study 1 (see table 1)
dat.nyhan1$outcome <- 6 - dat.nyhan1$crimechange #create misinformation disbelief scale (for consistency)
n8 <- length(dat.nyhan1$outcome)
nyhanetal.result1 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ correction,
dat=subset(dat.nyhan1, turk==0 & (clintonsupport==1 | trumpsupport == 1))))$coefficients[2], #fact check
ctrl.sd = sd(dat.nyhan1$outcome[dat.nyhan1$correction==0 & dat.nyhan1$turk==0],na.rm=T),  #no fact check
n.t = nrow(subset(dat.nyhan1,dat.nyhan1$correction==1 & dat.nyhan1$turk==0)),
n.c = nrow(subset(dat.nyhan1,dat.nyhan1$correction==0 & dat.nyhan1$turk==0)) )
nyhanetal.result2 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ correction,
dat=subset(dat.nyhan1, turk==1 & (clintonsupport==1 | trumpsupport == 1))))$coefficients[2], #fact check
ctrl.sd = sd(dat.nyhan1$outcome[dat.nyhan1$correction==0 & dat.nyhan1$turk==1],na.rm=T),  #no fact check
n.t = nrow(subset(dat.nyhan1,dat.nyhan1$correction==1 & dat.nyhan1$turk==1)),
n.c = nrow(subset(dat.nyhan1,dat.nyhan1$correction==0 & dat.nyhan1$turk==1)) )
#study 2
dat.nyhan2$outcome <- 6 - dat.nyhan2$ans #create misinformation disbelief scale (for consistency)
n9 <- length(dat.nyhan2$outcome)
nyhanetal.result3 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr_cond == "Correction",1,0),
dat=subset(dat.nyhan2)))$coefficients[2], #fact check
ctrl.sd = sd(dat.nyhan2$outcome[ifelse(dat.nyhan2$corr_cond == "Correction",1,0) == 0],na.rm=T),  #no fact check
n.t = nrow(subset(dat.nyhan2,ifelse(dat.nyhan2$corr_cond == "Correction",1,0) == 1)),
n.c = nrow(subset(dat.nyhan2,ifelse(dat.nyhan2$corr_cond == "Correction",1,0) == 0)) )
#(f) nyhan and reifler 2010 ####
dat.nyhanreifler1$outcome <- NA #create misinformation disbelief scale (for consistency)
dat.nyhanreifler1$outcome[dat.nyhanreifler1$wmds == "Strongly agree"] <- 1
dat.nyhanreifler1$outcome[dat.nyhanreifler1$wmds == "Somewhat agree"] <- 2
dat.nyhanreifler1$outcome[dat.nyhanreifler1$wmds == "Neither agree nor disagree"] <- 3
dat.nyhanreifler1$outcome[dat.nyhanreifler1$wmds == "Somewhat disagree"] <- 4
dat.nyhanreifler1$outcome[dat.nyhanreifler1$wmds == "Strongly disagree"] <- 5
dat.nyhanreifler2$outcome1 <- 6 - dat.nyhanreifler2$iraqwmd #create misinformation disbelief scale (for consistency)
dat.nyhanreifler2$outcome2 <- 6 - dat.nyhanreifler2$taxcutrev
dat.nyhanreifler2$outcome3 <- 6 - dat.nyhanreifler2$stemcellban
n10 <- length(dat.nyhanreifler1$outcome)
n11 <- length(dat.nyhanreifler2$outcome1)
n13 <-  length(dat.nyhanreifler2$outcome3)
nyhanreifler.result1 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ iraqcorr + ideolcen + know + ms, dat=dat.nyhanreifler1))$coefficients[2], #correction
ctrl.sd = sd(dat.nyhanreifler1$outcome[dat.nyhanreifler1$iraqcorr==0],na.rm=T),  #no correction
n.t = nrow(subset(dat.nyhanreifler1,dat.nyhanreifler1$iraqcorr==1)),
n.c = nrow(subset(dat.nyhanreifler1,dat.nyhanreifler1$iraqcorr==0))
)
nyhanreifler.result2 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome1 ~ iraqcorr + ideolcen + know, dat=dat.nyhanreifler2))$coefficients[2], #wmd correction
ctrl.sd = sd(dat.nyhanreifler2$outcome1[dat.nyhanreifler2$iraqcorr==0],na.rm=T),  #no correction
n.t = nrow(subset(dat.nyhanreifler2,dat.nyhanreifler2$iraqcorr==1)),
n.c = nrow(subset(dat.nyhanreifler2,dat.nyhanreifler2$iraqcorr==0))
)
nyhanreifler.result3 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome2 ~ taxcutcorr + ideolcen + know, dat=dat.nyhanreifler2))$coefficients[2], #tax correction
ctrl.sd = sd(dat.nyhanreifler2$outcome2[dat.nyhanreifler2$taxcutcorr==0],na.rm=T),  #no correction
n.t = nrow(subset(dat.nyhanreifler2,dat.nyhanreifler2$taxcutcorr==1)),
n.c = nrow(subset(dat.nyhanreifler2,dat.nyhanreifler2$taxcutcorr==0))
)
nyhanreifler.result4 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome3 ~ sccorr + ideolcen + know, dat=dat.nyhanreifler2))$coefficients[2], #stem cell correction
ctrl.sd = sd(dat.nyhanreifler2$outcome3[dat.nyhanreifler2$sccorr==0],na.rm=T),  #no correction
n.t = nrow(subset(dat.nyhanreifler2,dat.nyhanreifler2$sccorr==1)),
n.c = nrow(subset(dat.nyhanreifler2,dat.nyhanreifler2$sccorr==0))
)
#(g) wood and porter 2019 ####
dat.woodporter1$outcome <- 6 - dat.woodporter1$ans #create misinformation disbelief scale (for consistency)
n14 <- length(dat.woodporter1$outcome)
#STUDY 1
#(note results are numbered in accordance with their order of appearance in Table 1)
woodporter.result01 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Gun violence at all time high (Clinton)(1)")))$coefficients[2], #item 1 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Gun violence at all time high (Clinton)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Gun violence at all time high (Clinton)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Gun violence at all time high (Clinton)(1)"))
)
woodporter.result02 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Most prisoners serving drug sentences (Obama)(1)")))$coefficients[2], #item 2 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Most prisoners serving drug sentences (Obama)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Most prisoners serving drug sentences (Obama)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Most prisoners serving drug sentences (Obama)(1)"))
)
woodporter.result03 <- NA   #more jobs in solar than oil (Clinton) does not exist for study 1 despite indication in Table 1
woodporter.result04 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Workers pay more tax than financiers (Clinton)(1)")))$coefficients[2], #item 4 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Workers pay more tax than financiers (Clinton)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Workers pay more tax than financiers (Clinton)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Workers pay more tax than financiers (Clinton)(1)"))
)
woodporter.result05 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Discrimin. sole cause wage gap (Obama)(1)")))$coefficients[2], #item 5 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Discrimin. sole cause wage gap (Obama)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Discrimin. sole cause wage gap (Obama)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Discrimin. sole cause wage gap (Obama)(1)"))
)
woodporter.result06 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama cuts defense spending (Rubio)(1)")))$coefficients[2], #item 6 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama cuts defense spending (Rubio)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama cuts defense spending (Rubio)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama cuts defense spending (Rubio)(1)"))
)
woodporter.result07 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Undocumented disprop. criminal (Trump)(1)")))$coefficients[2], #item 7 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Undocumented disprop. criminal (Trump)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Undocumented disprop. criminal (Trump)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Undocumented disprop. criminal (Trump)(1)"))
)
woodporter.result08 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Surge in killings of police officers (Cruz)(1)")))$coefficients[2], #item 8 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Surge in killings of police officers (Cruz)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Surge in killings of police officers (Cruz)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Surge in killings of police officers (Cruz)(1)"))
)
woodporter.result09 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "US taxes highest in world (Trump)(1)")))$coefficients[2], #item 9 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "US taxes highest in world (Trump)(1)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "US taxes highest in world (Trump)(1)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "US taxes highest in world (Trump)(1)"))
)
#STUDY 2
woodporter.result10 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama passed TARP (Palin)(2)")))$coefficients[2], #item 10 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama passed TARP (Palin)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama passed TARP (Palin)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama passed TARP (Palin)(2)"))
)
woodporter.result11 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama passed TARP (Obama)(2)")))$coefficients[2], #item 11 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama passed TARP (Obama)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama passed TARP (Obama)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama passed TARP (Obama)(2)"))
)
woodporter.result12 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama accomodates undocumented (Cruz)(2)")))$coefficients[2], #item 12 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama accomodates undocumented (Cruz)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama accomodates undocumented (Cruz)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama accomodates undocumented (Cruz)(2)"))
)
woodporter.result13 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama accomodates undocumented (Gutiérrez)(2)")))$coefficients[2], #item 13 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama accomodates undocumented (Gutiérrez)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama accomodates undocumented (Gutiérrez)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama accomodates undocumented (Gutiérrez)(2)"))
)
woodporter.result14 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Spiraling teen pregnancy rate (Carson)(2)")))$coefficients[2], #item 14 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling teen pregnancy rate (Carson)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Spiraling teen pregnancy rate (Carson)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling teen pregnancy rate (Carson)(2)"))
)
woodporter.result15 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Spiraling teen pregnancy rate (Lee)(2)")))$coefficients[2], #item 15 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling teen pregnancy rate (Lee)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Spiraling teen pregnancy rate (Lee)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling teen pregnancy rate (Lee)(2)"))
)
woodporter.result16 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "China holds majority of US debt (Romney)(2)")))$coefficients[2], #item 16 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "China holds majority of US debt (Romney)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "China holds majority of US debt (Romney)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "China holds majority of US debt (Romney)(2)"))
)
woodporter.result17 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "China holds majority of US debt (Obama)(2)")))$coefficients[2], #item 17 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "China holds majority of US debt (Obama)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "China holds majority of US debt (Obama)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "China holds majority of US debt (Obama)(2)"))
)
woodporter.result18 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Whites imminently a minority (Graham)(2)")))$coefficients[2], #item 18 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Whites imminently a minority (Graham)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Whites imminently a minority (Graham)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Whites imminently a minority (Graham)(2)"))
)
woodporter.result19 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Whites imminently a minority (Longoria)(2)")))$coefficients[2], #item 19 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Whites imminently a minority (Longoria)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Whites imminently a minority (Longoria)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Whites imminently a minority (Longoria)(2)"))
)
woodporter.result20 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Spiraling Chicago gun violence (LaPierre)(2)")))$coefficients[2], #item 20 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling Chicago gun violence (LaPierre)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Spiraling Chicago gun violence (LaPierre)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling Chicago gun violence (LaPierre)(2)"))
)
woodporter.result21 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Spiraling Chicago gun violence (Obama)(2)")))$coefficients[2], #item 21 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling Chicago gun violence (Obama)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Spiraling Chicago gun violence (Obama)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling Chicago gun violence (Obama)(2)"))
)
woodporter.result22 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Spiraling abortion rate (Ryan)(2)")))$coefficients[2], #item 22 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling abortion rate (Ryan)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Spiraling abortion rate (Ryan)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling abortion rate (Ryan)(2)"))
)
woodporter.result23 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Spiraling abortion rate (Obama)(2)")))$coefficients[2], #item 23 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling abortion rate (Obama)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Spiraling abortion rate (Obama)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Spiraling abortion rate (Obama)(2)"))
)
woodporter.result24 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama restricts drones' use (Graham)(2)")))$coefficients[2], #item 24 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama restricts drones' use (Graham)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama restricts drones' use (Graham)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama restricts drones' use (Graham)(2)"))
)
woodporter.result25 <- stand.result(eff.type = "reg.coef",
u.s.d = summary(lm(outcome ~ ifelse(corr=="Correction",1,0),
dat=subset(dat.woodporter1,dat.woodporter1$item == "Obama restricts drones' use (Obama)(2)")))$coefficients[2], #item 25 correction
ctrl.sd = sd(dat.woodporter1$outcome[dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama restricts drones' use (Obama)(2)"],na.rm=T),  #no correction
n.t = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="Correction" & dat.woodporter1$item == "Obama restricts drones' use (Obama)(2)")),
n.c = nrow(subset(dat.woodporter1,dat.woodporter1$corr=="No Correction" & dat.woodporter1$item == "Obama restricts drones' use (Obama)(2)"))
)
#(h) badrinathan, chauchard, and flynn (working paper)####
badrinathan.result1 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.104, #inverted for consistency
ctrl.sd = 1.096,  #overall sd of outcome
n.t = round(5104*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5104*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
badrinathan.result2 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.190,  #inverted for consistency
ctrl.sd = 0.949,  #overall sd of outcome
n.t = round(5103*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5103*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
badrinathan.result3 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.448,  #inverted for consistency
ctrl.sd = 1.058,  #overall sd of outcome
n.t = round(5061*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5061*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
badrinathan.result4 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.106,  #inverted for consistency
ctrl.sd = 1.061,  #overall sd of outcome
n.t = round(5099*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5099*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
badrinathan.result5 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.024,  #inverted for consistency
ctrl.sd = 1.014,  #overall sd of outcome
n.t = round(5136*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5136*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
badrinathan.result6 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.411,  #inverted for consistency
ctrl.sd = 1.264,  #overall sd of outcome
n.t = round(5109*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5109*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
badrinathan.result7 <- stand.result(eff.type = "reg.coef",
u.s.d = 0.109,  #inverted for consistency
ctrl.sd = 1.049,  #overall sd of outcome
n.t = round(5117*0.75,1), #estimate: 75% of sample (see working paper p. 11)
n.c = round(5117*0.25,1)) #estimate: 25% of sample (see working paper p. 11)
##########################################################################
#### ATE meta-analysis ####
#(a) RE meta-analysis ####
correction_data <- as.data.frame(cbind(c(huang.result1$results[1],huang.result2$results[1],huang.result3$results[1],huang.result4$results[1],
berinsky.result1$results[1],berinsky.result2$results[1],berinsky.result3$results[1],berinsky.result4$results[1],
nyhanreifler.result1$results[1],nyhanreifler.result2$results[1],nyhanreifler.result3$results[1],nyhanreifler.result4$results[1],
nyhanetal.result1$results[1],nyhanetal.result2$results[1],nyhanetal.result3$results[1],
clayton.result1$results[1], clayton.result2$results[1], clayton.result3$results[1],
woodporter.result01$results[1],woodporter.result02$results[1],woodporter.result04$results[1],woodporter.result05$results[1],
woodporter.result06$results[1],woodporter.result07$results[1],woodporter.result08$results[1],woodporter.result09$results[1],
woodporter.result10$results[1],woodporter.result11$results[1],woodporter.result12$results[1],woodporter.result13$results[1],
woodporter.result14$results[1],woodporter.result15$results[1],woodporter.result16$results[1],woodporter.result17$results[1],
woodporter.result18$results[1],woodporter.result19$results[1],woodporter.result20$results[1],woodporter.result21$results[1],
woodporter.result22$results[1],woodporter.result23$results[1],woodporter.result24$results[1],woodporter.result25$results[1],
badrinathan.result1$results[1],badrinathan.result2$results[1],badrinathan.result3$results[1],badrinathan.result4$results[1],
badrinathan.result5$results[1],badrinathan.result6$results[1],badrinathan.result7$results[1]),
c(huang.result1$results[3],huang.result2$results[3],huang.result3$results[3],huang.result4$results[3],
berinsky.result1$results[3],berinsky.result2$results[3],berinsky.result3$results[3],berinsky.result4$results[3],
nyhanreifler.result1$results[3],nyhanreifler.result2$results[3],nyhanreifler.result3$results[3],nyhanreifler.result4$results[3],
nyhanetal.result1$results[3],nyhanetal.result2$results[3],nyhanetal.result3$results[3],
clayton.result1$results[3], clayton.result2$results[3], clayton.result3$results[3],
woodporter.result01$results[3],woodporter.result02$results[3],woodporter.result04$results[3],woodporter.result05$results[3],
woodporter.result06$results[3],woodporter.result07$results[3],woodporter.result08$results[3],woodporter.result09$results[3],
woodporter.result10$results[3],woodporter.result11$results[3],woodporter.result12$results[3],woodporter.result13$results[3],
woodporter.result14$results[3],woodporter.result15$results[3],woodporter.result16$results[3],woodporter.result17$results[3],
woodporter.result18$results[3],woodporter.result19$results[3],woodporter.result20$results[3],woodporter.result21$results[3],
woodporter.result22$results[3],woodporter.result23$results[3],woodporter.result24$results[3],woodporter.result25$results[3],
badrinathan.result1$results[3],badrinathan.result2$results[3],badrinathan.result3$results[3],badrinathan.result4$results[3],
badrinathan.result5$results[3],badrinathan.result6$results[3],badrinathan.result7$results[3]),
c("Huang 2017 (China)","Huang 2017 (China)","Huang 2017 (China)","Huang 2017 (China)","Berinsky 2017 (US)","Berinsky 2017 (US)","Berinsky 2017 (US)","Berinsky 2017 (US)",
"Nyhan and Reifler 2010 (US)","Nyhan and Reifler 2010 (US)", "Nyhan and Reifler 2010 (US)","Nyhan and Reifler 2010 (US)",
"Nyhan et al. 2019 (US)","Nyhan et al. 2019 (US)", "Nyhan et al. 2019 (US)",
"Clayton et al. 2019 (US)", "Clayton et al. 2019 (US)", "Clayton et al. 2019 (US)",
"Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ",
"Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ",
"Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ",
"Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ",
"Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ", "Wood and Porter 2019 (US)    ",
"Badrinathan et al. (India)",  "Badrinathan et al. (India)",  "Badrinathan et al. (India)",   "Badrinathan et al. (India)",
"Badrinathan et al. (India)",   "Badrinathan et al. (India)", "Badrinathan et al. (India)")  ))
colnames(correction_data) <- c("d","se_d","study")
correction_data$study <- as.character(correction_data$study)
correction_data$d <- as.numeric(as.character(correction_data$d))
correction_data$se_d <- as.numeric(as.character(correction_data$se_d))
#random effects, without unpublished work
meta.re <- rma.mv(d,(se_d)^2,
random = list(~ 1 | as.numeric(as.factor(study))),
tdist = TRUE,
slab = study,
data = subset(correction_data,correction_data$study != "Badrinathan et al. (India)"))
meta.re
meta.re$beta
meta.re$b
meta.re$se
